package com.shop.domain.store;

import com.alibaba.fastjson.annotation.JSONField;
import com.shop.jpa.domain.BaseDomain;
import com.shop.jpa.support.JpaConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>StoreCategory 实体类</p>
 * <p>Table: t_store_category - 商品分类表</p>
 * @author generator
 * @date 2021-02-08 04:17:49
 */
@ApiModel("StoreProductCate 实体类")
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "t_store_category")
@SQLDelete(sql = "update t_store_category set is_deleted = 1 where id = ?")
@Where(clause = JpaConst.WHERE_CLAUSE_NOT_DELETED)
@DynamicInsert(true)
@DynamicUpdate(true)
public class StoreCategory extends BaseDomain implements Serializable {

    @ApiModelProperty(value = "id", hidden = true)
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
	@JSONField(serialize=false)
    private Long id;

    /**
	 * 父id
	 */
    @ApiModelProperty("父id")
	@Column(name = "pid")
    private Long pid;

    /**
	 * 名称
	 */
    @ApiModelProperty("名称")
	@Column(name = "cate_name")
    private String cateName;

    /**
     * 图标
     */
    @ApiModelProperty("图标")
    @Column(name = "pic")
    private String pic;

    /**
     * 排序序号
     */
    @ApiModelProperty("排序序号")
    @Column(name = "sort")
    private Integer sort;

    /**
     * 是否展示
     */
    @ApiModelProperty("是否展示")
    @Column(name = "is_show")
    private Integer isShow;

    /**
	 * 创建时间
	 */
    @ApiModelProperty("创建时间")
	@Column(name = "create_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
	 * 修改时间
	 */
    @ApiModelProperty("修改时间")
	@Column(name = "update_time")
    @JSONField(serialize=false)
    private Date updateTime;

    /**
	 * 是否删除
	 */
    @ApiModelProperty("是否删除")
	@Column(name = "is_deleted")
    @JSONField(serialize=false)
    private Integer isDeleted;
}